package main

import (
	"strings"

	"golang.org/x/tour/wc"
)

func WordCount(s string) map[string]int {
	cnt := make(map[string]int)
	// 通过Split方法拆分字符串
	for _, str := range strings.Split(s, " ") {
		cnt[str]++
	}
	return cnt
}

func main() {
	wc.Test(WordCount)
}
